<template>
  <div>
    <div class="banner">
      <img @click="handleBannerClick" class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="title">
          {{sightName}}
        </div>
        <div class="number">
          <span class="iconfont">&#xe626;</span>
          {{gallaryImgsLength}}
        </div>
      </div>
    </div>
    <fade>
      <common-gallary
        v-show="showGallary"
        @close="handleGallaryClose"
        :imgs="gallaryImgs"
      >
      </common-gallary>
    </fade>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import Fade from 'common/fade/Fade'
export default {
  name: 'DetailBanner',
  components: { CommonGallary, Fade },
  props: {
    bannerImg: String,
    gallaryImgs: Array,
    sightName: String
  },
  computed: {
    gallaryImgsLength () {
      return this.gallaryImgs.length
    }
  },
  data () {
    return {
      showGallary: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position relative
    height 0
    padding-bottom 54.6%
    overflow hidden
    .banner-img
      width 100%
    .banner-info
      position absolute
      bottom 0
      left 0
      right 0
      display flex
      justify-content space-between
      padding .1rem .2rem .2rem .2rem
      box-sizing border-box
      color #fff
      background-image linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.8))
      .title
        font-size .36rem
      .number
        padding 0 .3rem
        height .36rem
        line-height .36rem
        border-radius .2rem
        background-color rgba(0,0,0,.5)
</style>
